Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument parsing to mock_tests to enable SWSS debugs #3283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikemallin
Copy link

@mikemallin mikemallin commented Sep 8, 2024

NOTE: This depends on the changes in sonic-net/sonic-swss-common#914

What I did
Added new program options to the SWSS Mock Tests to enable dumping SWSS debugs:

Supported logging options:                                                         
  --help                                Display program help
  -l [ --swss-log-level ] arg (=NOTICE) Sets the SWSS logging level. Supported 
                                        levels are: EMERG, ALERT, CRIT, ERROR, 
                                        WARN, NOTICE, INFO, DEBUG
  --swss-log-output arg (=SYSLOG)       Sends SWSS logs to the desired output 
                                        stream. Supported locations are: 
                                        SYSLOG, STDOUT, STDERR

Why I did it

  • Debugging without the logs is painful

How I verified it

  • ./tests --help:
Supported logging options:     
  --help                                Display program help
  -l [ --swss-log-level ] arg (=NOTICE) Sets the SWSS logging level. Supported 
                                        levels are: EMERG, ALERT, CRIT, ERROR, 
                                        WARN, NOTICE, INFO, DEBUG           
  --swss-log-output arg (=SYSLOG)       Sends SWSS logs to the desired output 
                                        stream. Supported locations are: 
                                        SYSLOG, STDOUT, STDERR

This program contains tests written using Google Test. You can use the
following command line flags to control its behavior:

<snip>
  • ./tests --swss-log-level DEBUG --swss-log-output STDOUT --gtest_filter=RouteOrch*:
NOTICE:- doTask: Route 10.10.10.10/32: resize ipv to match alsv, 0 -> 1.
NOTICE:- doTask: Route 10.10.10.10/32: set the empty nexthop ip to zero.
  INFO:- create_entry: EntityBulker.create_entry 1, 1, 1

  WARN:- doTask: Route 192.168.0.1/32 is received on non L3 VNI 5000
  INFO:- flush_creating_entries: EntityBulker.flush creating_entries 1

  INFO:- increaseRouterIntfsRefCount: Router interface Ethernet0 ref count is increased to 5
  INFO:- addRoutePost: Post create route 10.10.10.10/32 with next hop(s) 0.0.0.0@Ethernet0
  INFO:- isMuxNexthops: No mux nexthop found
NOTICE:- uninitialize: begin
NOTICE:- uninitialize: stopping threads
NOTICE:- stopUnittestThread: begin
NOTICE:- unittestChannelThreadProc: exit VS unittest channel thread
NOTICE:- stopUnittestThread: end
NOTICE:- stopFdbAgingThread: begin
NOTICE:- fdbAgingThreadProc: end
[Thread 0x7ffff5d89700 (LWP 47996) exited]
NOTICE:- stopFdbAgingThread: end
NOTICE:- stopEventQueueThread: begin
NOTICE:- processQueueEvent: received EVENT_TYPE_END_THREAD, will process all messages and end
[Thread 0x7ffff658a700 (LWP 47997) exited]
NOTICE:- stopEventQueueThread: end
[Thread 0x7ffff6d8b700 (LWP 47995) exited]
NOTICE:- ~SwitchState: begin
NOTICE:- ~SwitchState: switch oid:0x2100000000
NOTICE:- ~SwitchState: end
NOTICE:- uninitialize: end                                                                                                        

Copy link
Contributor

@siqbal1986 siqbal1986 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mikemallin
Copy link
Author

Thank you @siqbal1986 ! Would you be able to approve sonic-net/sonic-swss-common#914 as well? This change depends on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants